import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProjectConfigVO, ProjectConfigForm, ProjectConfigQuery } from '@/api/device/projectConfig/types';

/**
 * 查询工程配置列表
 * @param query
 * @returns {*}
 */

export const listProjectConfig = (query?: ProjectConfigQuery): AxiosPromise<ProjectConfigVO[]> => {
  return request({
    url: '/system/projectConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工程配置详细
 * @param id
 */
export const getProjectConfig = (id: string | number): AxiosPromise<ProjectConfigVO> => {
  return request({
    url: '/system/projectConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增工程配置
 * @param data
 */
export const addProjectConfig = (data: ProjectConfigForm) => {
  return request({
    url: '/system/projectConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改工程配置
 * @param data
 */
export const updateProjectConfig = (data: ProjectConfigForm) => {
  return request({
    url: '/system/projectConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除工程配置
 * @param id
 */
export const delProjectConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/projectConfig/' + id,
    method: 'delete'
  });
};
